<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('模版下的文件')" />
</head>
<body>    <!-- 参考 authRole.html修改的 TODO 支持生成 -->
    <div class="main-content">
        <form id="form-user-add" class="form-horizontal">
            <input type="hidden" id="templateId" name="templateId" th:value="${genTemplate.templateId}">
            <h4 class="form-header h4">模版信息</h4>
            <div class="row">
            	<div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">模版名称：</label>
                        <div class="col-sm-8">
                            <input name="templateName" class="form-control" type="text" disabled th:value="${genTemplate.templateName}">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">模版描述：</label>
                        <div class="col-sm-8">
                            <input name="templateDesc" class="form-control" type="text" disabled th:value="${genTemplate.templateDesc}">
                        </div>
                    </div>
                </div> 
            </div>
           
            <h4 class="form-header h4">模版文件</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="col-sm-12 select-table table-striped">
					    <table id="bootstrap-table"></table>
					</div>
                </div>
            </div>
        </form>
    </div>
      
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <!--button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;-->
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
	<th:block th:include="include :: footer" />
	<script th:inline="javascript">
	    var prefix = ctx + "generator/templateFile";
	    var files = [[${genTemplateFiles}]]
	    
	    $(function() {
		    var options = {
		        data: files,
		        sidePagination: "client",
		        sortName: "fileName",
		        showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                clickToSelect: true,
                maintainSelected: true,
		        columns: [{
		            checkbox: true,
		            formatter:function (value, row, index) {
		            	if($.common.isEmpty(value)) {
		            		return { checked: row.flag };
		            	} else {
		            		return { checked: value }
		            	}
		            }
		        },
                {
                    field: 'fileId',
                    title: '文件主键',
                    visible: false
                },
                {
                    field: 'fileName',
                    title: '代码文件名称'
                },
                {
                    field: 'filePath',
                    title: '模版文件路径'
                },
                {
                    field: 'fileExt',
                    title: '代码类型'
                },
                {
                    field: 'remark',
                    title: '备注'
                }
                ]
		    };
		    $.table.init(options);
		});
	    
	    /* 添加角色-提交 */
        /*function submitHandler(index, layero){
            var roleIds = [];
        	var data = $('#bootstrap-table').bootstrapTable('getData');
        	for (var i = 0; i < data.length; i++) {
        		if (data[i][0] || ($.common.isEmpty(data[i][0]) && data[i].flag)) {
        		    roleIds.push(data[i].roleId)
        		}
			}
        	$.operate.saveTab(prefix + "/insertAuthRole", { "userId": $("#userId").val(), "roleIds": roleIds.join() });
        }*/
    </script>
</body>
</html>